<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      // 說明：indexOf 返回目标值出现的第一个位置的索引值
      function unit(arr) {
        return arr.filter((item, index) => {
          return arr.indexOf(item) === index;
        });
      }

      console.log("arr-------->>>", unit([1, 2, 3, 2, 3, 5, 6]));
    </script>
  </body>
</html>
